﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MagicBag.CRM.Model;
using MagicBag.CRM.IDAL;
namespace MagicBag.CRM.BLL
{
    public class CommonDictionaryBLL
    {
        //创建数据访问对象
        private static readonly ICommonDictionary commonDictionaryDAL = DALFactory.DataAccess.CreateCommonDictionary();

        public CommonDictionaryBLL()
        { }

        public int Insert(CommonDictionary dic)
        {
            //logic handle
            return commonDictionaryDAL.Insert(dic);
        }

        public int Delete(int id)
        {
            if (id == 0) return -1;
            return commonDictionaryDAL.Delete(id);
        }

        public int Update(CommonDictionary dic)
        {
            return commonDictionaryDAL.Update(dic);
        }

        public CommonDictionary GetCommonDictionary(int id)
        {
            return commonDictionaryDAL.GetCommonDictionary(id);
        }

        public IList<CommonDictionary> GetCommonDictionary(string categroy)
        {
            return commonDictionaryDAL.GetCommonDictionary(categroy);
        }

        public IList<CommonDictionary> GetCommonDictionaries()
        {
            return commonDictionaryDAL.GetCommonDictionaries();
        }

        public IList<CommonDictionary> GetCommonDictionaries(int pageIndex, int pageSize,out int total)
        {
            return commonDictionaryDAL.GetCommonDictionaries(pageIndex, pageSize,out total);
        }

        public IList<CommonDictionary> GetCategories()
        {
            return commonDictionaryDAL.GetCategories();
        }
    }
}
